<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Insert title here</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Hello, Bootstrap Table!</title>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--    <script th:src="@{/js/jquery-3.2.1.min.js}"></script>-->
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <!-- 最新 Bootstrap4 核心 CSS 文件 -->
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
    <script rel="stylesheet" th:src="@{/js/bootstrap.bundle.min.js} "></script>
    <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
    <script	th:src="@{/js/bootstrap.min.js}"rel="stylesheet"> </script>

    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/css/bootstrapValidator.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.min.js"></script>
    <script th:src="@{/js/functions.js}"></script>

</head>
<body>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div th:include="../templates/user/top::headtop"></div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <h1 class="col-md-5">电影页面</h1>
                    </div>
                </div>



                <div class="row">
                    <div th:each="u,stat:${MovieList}" class="col-md-3">
                        <img th:src="${u.film_pic}" style="width: 167px;height: 160px"/>


                        <br>


                        <span th:align="top">[[${u.film_name}]]</span>
                        &nbsp;&nbsp;&nbsp;
                        <span><button class="btn btn-default btn-xs btn-danger btn-primary" th:onclick="Updata([[${u.film_id}]])">购买</button></span>
                        <br  th:if="(${stat.index}+1)%4==0">
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function goods_cut(){

        var num_val=document.getElementById('number');

        var new_num=num_val.value;

        var Num = parseInt(new_num);

        if(Num>1)Num=Num-1;

        num_val.value=Num;

    }

    function goods_add(){

        var num_val=document.getElementById('number');

        var new_num=num_val.value;

        var Num = parseInt(new_num);

        Num=Num+1;

        num_val.value=Num;

    }
    function addSorder(id,price) {
        var sel=document.getElementById("number").value;
        if (sel <= 0) {
            alert("请选择商品数量");
            return false;
        }



        // if(window.confirm("确定删除吗")){
        //      window.location=getContextPath()+"/order/addSOrder?number="+sel+"&&shop_ids="+id;
        // }

        if (window.confirm("确定购买吗")) {
            $.post(getContextPath()+"/order/addSOrder", {number:sel,shop_id:id,shop_price:price}, function (data) {
                window.location.reload();
            });
        }

    }


    function Updata(id) {
        window.location = getContextPath() + "/user/details?id=" + id;

    }


</script>




</body>
</html>